package vip.xiaonuo.smzq.modular.hisi.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.hisi.entity.KsZyclhz;
import vip.xiaonuo.smzq.modular.hisi.entity.param.TbkstjParam;
import vip.xiaonuo.smzq.modular.hisi.service.IKsZyclhzService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * 矿山资源储量汇总
 *
 * @author sqq
 * @since 2024-07-04
 */
@Api(tags = "矿山资源储量汇总")
@RestController
@RequestMapping("/hisi/ksZyclhz")
@Validated
public class KsZyclhzController {

    @Resource
    private IKsZyclhzService iKsZyclhzService;

    /**
     * 添加矿山资源储量汇总
     */
    @ApiOperation("添加矿山资源储量汇总")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid KsZyclhz ksZyclhz) {
        iKsZyclhzService.save(ksZyclhz);
        return CommonResult.ok();
    }

    /**
     * 删除矿山资源储量汇总
     */
    @ApiOperation("删除矿山资源储量汇总")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iKsZyclhzService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑矿山资源储量汇总
     */
    @ApiOperation("编辑矿山资源储量汇总")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid KsZyclhz ksZyclhz) {
        iKsZyclhzService.updateById(ksZyclhz);
        return CommonResult.ok();
    }

    /**
     * 矿山资源储量汇总分页查询
     */
    @ApiOperation("矿山资源储量汇总分页查询")
    @GetMapping("/list")
    public CommonResult<Page<KsZyclhz>> page() {
        return CommonResult.data(iKsZyclhzService.page(new KsZyclhz()));
    }


    /**
     * 同步矿山资源储量汇总
     *  @param tbkstjParam
     *  @return String
     *  @Author sqq
     *  @Date 2024/7/4 16:04
     */

    @ApiOperation("同步矿山资源储量汇总")
    @PostMapping("/synchronizingKsData")
    public CommonResult<String> synchronizingKsData(@RequestBody @Valid TbkstjParam tbkstjParam) {
        iKsZyclhzService.synchronizingKsData(tbkstjParam);
        return CommonResult.ok();
    }
    /**
     * 同步矿山资源储量汇总
     *  @param ndStr 年度1,2,3
     *  @return String
     *  @Author sqq
     *  @Date 2024/7/4 16:04
     */

    @ApiOperation("同步矿山多年度资源储量汇总")
    @GetMapping("/synchronizingKsDataNd")
    public CommonResult<String> synchronizingKsDataNd(String ndStr) {

        iKsZyclhzService.synchronizingKsDataNd(ndStr);
        return CommonResult.ok();
    }


}
